﻿@{Html.BeginForm();}
<table>
    <tr>
        <td>Name:</td>
        <td>@Html.TextBox("Name")</td>
    </tr>
    <tr>
        <td>Type:</td>
        <td>
        <select id="Type" name="Type">
            <option value="Online" >Online</option>
            <option value="Offline" >Offline</option>
        </select>
    </tr>
    <tr>
        <td>Cached:</td>
        <td>
            <select id="IsCached" name="IsCached">
                <option value="true" >Yes</option>
                <option value="false" >No</option>
            </select>
        </td>
    </tr>
    <tr>
        <td>URL:</td>
        <td>@Html.TextBox("URL")</td>
    </tr>
    <tr>
        <td>Books:</td>
        <td>
        @{
            var books = ViewBag.Books;
            List<SelectListItem> booksItems = new List<SelectListItem>();
            foreach(BooksOnline.Book book in books){    
                booksItems.Add(new SelectListItem(){Text=book.Name, Value=book.Id.ToString()});
            }
            @Html.DropDownList("Books", booksItems);
         }</td>
    </tr>
    <tr>
        <td><input type="submit" value="Create" id="cmdSubmit" /></td>
        <td>@Html.ActionLink("Back","ListAllReferences","References")</td>
    </tr>
</table>
@{Html.EndForm();}

@if (false)
{
    <script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"></script>
}

<script type="text/javascript">

    $(document).ready(function () {
        $("input[id='chkCached']").click(CachedCheckedChanged);

    });

    var CachedCheckedChanged = function () {
        var isCached = $("input[id='chkCached']").val();

        alert(isCached);

    };

</script>